#ifndef ATMSENSOR_H
#define ATMSENSOR_H

#include <QObject>
#include <QString>
#include <QByteArray>
#include "serialportthread.h"

class atmsensor : public QObject
{
    Q_OBJECT
public:
    explicit atmsensor(QObject *parent = nullptr);
signals:
    void Temperature_changed(QString Temperature);
    void Humidity_changed(QString Humidity);
    void Pressure_changed(QString Pressure);
public slots:
    void ReceiveResp(const QByteArray response);
    void NoConnection();
    void InquireAddr();
    void InquireData();
    QString getTemperature();
    QString getHumidity();
    QString getPressure();
    void setPortName(const QString &portName);
private:
    int baudRate;
    int waittimeout, waitForReadyReadTime;
    QString request;

    unsigned long waitTime;

    serialportThread *sensor;
    QString Temperature;
    QString Humidity;
    QString Pressure;
    union AD_data
    {
        uchar S_Bit[2];
        int16_t signed_vol;
    };
};

#endif // ATMSENSOR_H
